package com.liaowei.article.openfeign;

import com.liaowei.article.config.OpenFeignConfig;
import com.liaowei.common.BaseResponse;
import com.liaowei.model.domain.Tag;
import com.liaowei.model.param.ArticleHistoryParam;
import com.liaowei.model.param.PostHistoryParam;
import com.liaowei.model.vo.UserVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(value = "user-service", configuration = OpenFeignConfig.class)
public interface UserClient {
    @GetMapping("/users/{userId}")
    BaseResponse<UserVO> getById(@PathVariable Long userId);

    // 新增帖子记录
    @PostMapping("/users/posts/histories/")
    BaseResponse<String> addPostHistory(@RequestBody PostHistoryParam postHistoryParam);

    // 新增文章历史记录
    @PostMapping("/users/articles/histories/")
    BaseResponse<String> addArticleHistory(@RequestBody ArticleHistoryParam articleHistoryParam);

    // 根据用户id和文章id删除文章记录
    @DeleteMapping("/users/articles/histories/{userId}/{articleId}")
    BaseResponse<String> deleteArticleHistoryByUserIdAndArticleId(@PathVariable("userId") Long userId,
                                                                  @PathVariable("articleId") Long articleId);

    // 根据用户id和文章id删除文章记录
    @GetMapping("/users/tags/interest/{userId}/")
    BaseResponse<List<Tag>> interestTagList(@PathVariable("userId") long userId);

}
